package com.holdtime.jtt809dataservice.common.domain;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 *  author: sunwei
 *  Date: 2025/3/14 18:31
 *  Description:
 */ 
public class SubordinatePlatformThreadPoolManager {
    private ThreadPoolExecutor threadPool;

    private SubordinatePlatformThreadPoolManager() {
        threadPool = new ThreadPoolExecutor(30, 100, 2,
                TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(40),
                new ThreadPoolExecutor.DiscardOldestPolicy());
    }

    private static SubordinatePlatformThreadPoolManager threadPoolManager = new SubordinatePlatformThreadPoolManager();

    public static SubordinatePlatformThreadPoolManager getCurrent() {
        return threadPoolManager;
    }

    public ThreadPoolExecutor getThreadPool() {
        return threadPool;
    }

    public void setThreadPool(ThreadPoolExecutor threadPool) {
        this.threadPool = threadPool;
    }
}
